package net.begincode.servlet.common;

import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;

import javax.servlet.ServletException;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import utils.BQStringUtil;
import net.begincode.bean.BcUser;
import net.begincode.service.blog.BlogService;
import net.begincode.service.blog.ClassifyService;
import net.begincode.service.blog.impl.BlogServiceImpl;
import net.begincode.service.blog.impl.ClassifyServiceImpl;
import net.begincode.service.chapter.impl.ChapterServiceImpl;
import net.begincode.service.code.impl.CodeServiceImpl;
import net.begincode.service.course.impl.CourseServiceImpl;
import net.begincode.service.down.impl.BcDownServiceImpl;
import net.begincode.service.manager.impl.ManagerServiceImpl;
import net.begincode.service.project.impl.ProjectServiceImpl;
import net.begincode.service.project.impl.ProjectStageServiceImpl;
import net.begincode.service.user.BcUserService;
import net.begincode.service.user.impl.BcUserServiceImpl;


public class ViewServlet {
	public static final String VIEW_CHAPTER = "chapter";
	public static final String VIEW_BLOG = "blog";
	public static final String VIEW_CODE = "code";
	public static final String VIEW_DOWN = "down";
	public static final String VIEW_PROJSTAGE = "projstage";
	
	
	/**
	 * 修改阅读次数
	 * */
	public static void updViewCount(String flag,String id,int count){
		if(flag.equals(VIEW_CHAPTER)){
			ChapterServiceImpl.getInstance().updChapterViewCount(id, count);
		}
		if(flag.equals(VIEW_CODE)){
			CodeServiceImpl.getInstance().updCodeViewCount(id, count);
		}
		if(flag.equals(VIEW_DOWN)){
			BcDownServiceImpl.getInstance().updDownViewCount(id, count);
		}
		if(flag.equals(VIEW_BLOG)){
			BlogServiceImpl.getInstance().updBlogViewCount(id, count);	
		}
		if(flag.equals(VIEW_PROJSTAGE)){
			ProjectStageServiceImpl.getInstance().updProStageViewCount(id, count);
		}
	}
}
